#!/bin/sh

job_name="%job_name"
ha_status="%ha_status"

if [ $job_name != "zkfc" ] || [ $ha_status != "active" ]; then
  exit 0
fi

# Only job zkfc need to cleanup zk
artifact="%artifact"

run_dir=`dirname "$0"`
run_dir=`cd "$run_dir"; pwd`

package_dir="$run_dir/package"
log_dir="$run_dir/log"
pid_file="$run_dir/${job_name}.pid"
output_file="$run_dir/${job_name}.out"

jar_dirs="%jar_dirs"
params="%params"

class_path="$run_dir/:$jar_dirs"

java="/opt/soft/jdk/bin/java"
if ! [ -e $java ]; then
  java="/usr/bin/java"
fi

exec $java -cp $class_path $params $@
